#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "common.h"
#define DEV IMG_DEV
// cameraID=0,x=22,y=34,enable=1,imgPath=图片路径
char wmark_str[256] = {0};
int main()
{
    int fd;
    int cameraID, displayX, displayY, enable;
    char imgPath[256] = {0};
    fd = open(DEV, O_RDWR);
    if (fd != - 1)
    {
        while (1)
        {
            printf("read.\n");
            read(fd, &wmark_str, sizeof(wmark_str));
            printf("The data is %s\n", wmark_str);
            sscanf(wmark_str, "cameraID=%d,x=%d,y=%d,enable=%d,imgPath=%s",
                    &cameraID, &displayX, &displayY, &enable, imgPath);
            printf("cameraID=%d,x=%d,y=%d,enable=%d,imgPath=%s",
                    cameraID, displayX, displayY, enable, imgPath);
            if (wmark_str[1] ==0x35)
            {
                close(fd);
                break;
            }
        }
    }
    else
    {
        printf("device open failure\n");
    }
    return 0;
}
